-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDE changes for "Unsigned Right Shift" feature, plus tests. #60689
IDE changes for "Unsigned Right Shift" feature, plus tests. #60689
Conversation
var code = @"$$ | ||
class C | ||
{ | ||
public static C operator >>> ( C x, C y){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider starting with no space or two spaces between operator
and >>>
, to show that part got formatted #Resolved
@"int x; | ||
|
||
x = x >>>$$ x;", | ||
MainDescription("int int.operator >>>(int left, int right)")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a similar QuickInfo scenario for >>>=
? (I'm not sure what's the expected behavior) #Resolved
@@ -328,6 +328,7 @@ class C<T> | |||
[InlineData("<=")] | |||
[InlineData("<<")] | |||
[InlineData(">>")] | |||
[InlineData(">>>")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tagging @BillWagner as we'll want landing pages for F1/Help on >>>
and >>>=
@@ -292,6 +292,7 @@ private static SyntaxKind GetTokenKind(OperatorKind kind) | |||
OperatorKind.Multiply => SyntaxKind.AsteriskToken, | |||
OperatorKind.OnesComplement => SyntaxKind.TildeToken, | |||
OperatorKind.RightShift => SyntaxKind.GreaterThanGreaterThanToken, | |||
OperatorKind.UnsignedRightShift => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another scenario that may be worth validating is MetadataAsSource. Hopefully, it's using the same syntax generator and is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 2)
@jasonmalinowski, @333fred Please review |
@jasonmalinowski Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDE part looks good. Only comments are some potential places for additional tests, but no reason to hold up this PR for that.
@@ -143,7 +143,7 @@ public static IEnumerable<SyntaxKind> GetPreprocessorKeywordKinds() | |||
|
|||
public static bool IsPunctuation(SyntaxKind kind) | |||
{ | |||
return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.QuestionQuestionEqualsToken; | |||
return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also including !! that wasn't included before; that seems reasonable to me but we think that was just an oversight before? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also including !! that wasn't included before; that seems reasonable to me but we think that was just an oversight before?
I think it was. CC @RikkiGibson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was an oversight. It looks like this could change behavior of classification of !!
, but I must not have added any tests for !!
to src/EditorFeatures/CSharpTest/Classification/SyntacticClassifierTests.cs
.
@@ -164,7 +164,7 @@ private static bool IsDebuggerSpecialPunctuation(SyntaxKind kind) | |||
|
|||
public static IEnumerable<SyntaxKind> GetPunctuationKinds() | |||
{ | |||
for (int i = (int)SyntaxKind.TildeToken; i <= (int)SyntaxKind.PercentEqualsToken; i++) | |||
for (int i = (int)SyntaxKind.TildeToken; i <= (int)SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a test that each kind returned from GetPunctuationKinds returns true for IsPunctuationKind? Since it seems there were other existing bugs here too. #Resolved
|
||
if (onRightOfToken) | ||
{ | ||
// x << Goo(), x >> Goo(), x <<= Goo(), x >>= Goo() | ||
// x << Goo(), x >> Goo(), x >>> Goo(), x <<= Goo(), x >>= Goo(), x >>>= Goo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roslyn/src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
Lines 194 to 199 in b0cd71f
[Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)] | |
public async Task TestBinaryOperator2(TestMode mode) | |
{ | |
await TestInMethodAsync( | |
@"var q = x >> [|Goo()|];", "global::System.Int32", mode); | |
} |
Test plan #60433